﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:local="clr-namespace:EIA.SLClient.PlatManage.BasicMgr"
	xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:System="clr-namespace:System;assembly=mscorlib"
	xmlns:EIA_SLClient_Utility_Controls="clr-namespace:EIA.SLClient.Utility.Controls;assembly=EIA.SLClient.Utility"
	xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
	mc:Ignorable="d"
	x:Class="EIA.SLClient.PlatManage.BasicMgr.DepartmentTreeView"
	d:DesignWidth="640" d:DesignHeight="480">
	<UserControl.Resources>
		<ResourceDictionary>
			<local:DepartmentTreeViewModel x:Key="DepartmentTreeViewModelDataSource" />
			<sdk:HierarchicalDataTemplate x:Key="DepartmentDataTemplate" ItemsSource="{Binding ChildNodes}">
				<Grid>
					<TextBlock Margin="4,0" TextWrapping="Wrap" Text="{Binding Data.DepName}" d:LayoutOverrides="Width, Height" VerticalAlignment="Center"/>
				</Grid>
			</sdk:HierarchicalDataTemplate>
		
		</ResourceDictionary>
		
	</UserControl.Resources>
	<UserControl.FontSize>
		<StaticResource ResourceKey="FontSize"/>
	</UserControl.FontSize>
	<UserControl.FontFamily>
		<StaticResource ResourceKey="FontFamily"/>
	</UserControl.FontFamily>

	<Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource DepartmentTreeViewModelDataSource}}">
		<i:Interaction.Triggers>
			<i:EventTrigger>
				<ei:CallMethodAction TargetObject="{Binding Mode=OneWay}" MethodName="OnLoad"/>
			</i:EventTrigger>
		</i:Interaction.Triggers>
		<Grid Margin="4" Background="#FFF2F2F2">
			<Grid.Effect>
				<DropShadowEffect BlurRadius="1" ShadowDepth="1" Opacity="0.1"/>
			</Grid.Effect>
			<Grid.RowDefinitions>
				<RowDefinition Height="32"/>
				<RowDefinition/>
				<RowDefinition Height="32"/>
			</Grid.RowDefinitions>
			<Border BorderBrush="#FFE1E1E1" BorderThickness="1">
				<Border.Background>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FFFCFCFC" Offset="0"/>
						<GradientStop Color="#FFEBEBEB" Offset="1"/>
					</LinearGradientBrush>
				</Border.Background>
				<Grid>
					<HyperlinkButton Content="添加" Command="{Binding InsertItemCommand}" HorizontalAlignment="Left" Margin="8,0,0,0" VerticalAlignment="Center" />
					<HyperlinkButton Content="修改" Command="{Binding UpdateItemCommand}" CommandParameter="{Binding SelectedNode}" HorizontalAlignment="Left" Margin="48,4,0,4" VerticalAlignment="Center" />
					<HyperlinkButton Content="删除" Command="{Binding DeleteItemCommand}" CommandParameter="{Binding SelectedNode}" HorizontalAlignment="Left" Margin="88,4,0,4" VerticalAlignment="Center" />
					<HyperlinkButton Content="重新载入" Command="{Binding RetrieveItemsCommand}" HorizontalAlignment="Right" Margin="0,0,8,0" VerticalAlignment="Center" />
				</Grid>
			</Border>
			<Border BorderBrush="#FFE1E1E1" BorderThickness="1,0" Grid.Row="1">
				<Grid>
					<EIA_SLClient_Utility_Controls:EditableTreeControl Margin="8" AddCommand="{Binding InsertItemCommand}" DeleteCommand="{Binding DeleteItemCommand}" EditCommand="{Binding UpdateItemCommand}" RootNodes="{Binding DepartmentRootNodes}" SelectedNode="{Binding SelectedNode, Mode=TwoWay}" DragDropCommand="{Binding DragDropCommand}" BorderThickness="1,0,1,1" BorderBrush="#FFE0E0E0" ExpendDepth="2"/>
				</Grid>
			</Border>
			<Border BorderBrush="#FFE1E1E1" BorderThickness="1" Grid.Row="2" Background="WhiteSmoke">
				<Grid/>
			</Border>
		</Grid>
	</Grid>
</UserControl>
